package deadlock

import (
	"fmt"
	"os"
	"strings"
	"time"
)

func OnPotentialDeadlockNullOutput(obj interface{}, stack *StackRecord) {
	return
}

var Options = struct {
	Disable bool

	DeadlockTimeout time.Duration

	OnPotentialDeadlock func(obj interface{}, stack *StackRecord)
}{
	DeadlockTimeout: time.Second * 30,
	OnPotentialDeadlock: func(obj interface{}, stack *StackRecord) {
		var sb strings.Builder
		PrintDeadLockStack(&sb, obj, stack)
		if sb.Len() > 0 {
			fmt.Fprintf(os.Stderr, sb.String())
		}
	},
}
